/*
  What is the probability of getting a pair in 6 cards from a standard
  deck?
*/
#include <stdlib.h>
#include <set>
#include <iostream>

using namespace std;

// Monte Carlo method
int main( int argc, char* argv[] ) {
    srand( time(NULL) );
    const unsigned iterations = 100000;
    unsigned won = 0;
    for ( unsigned i = 0; i < iterations; i++ ) {
	set<unsigned> hand, check;
	while ( hand.size() < 6 ) { 
	    const unsigned card( rand() % 52 );
	    hand.insert( card );
	    check.insert( card % 13 );
	}
	if ( check.size() < 6 ) { won++; }
    }
    cout << (double)won/iterations << endl;
}
